1. Field of the Invention
The invention relates in general to a decoding technique, and more particularly to a decoding technique for unary/kth order exponential Golomb (UEGk) codes.
2. Description of the Related Art
Unary/kth order exponential Golomb (UEGk) codes, featuring advantages of both a high compression rate of unary coding and a shorter length of kth order exponential Golomb coding, is prevalent in various video specifications including H.264, MPEG-4, and AVC.
The U.S. Pat. No. 6,982,663 discloses details of an encoding method for UEGk codes. A UEGk decoder converts a series of consecutively received 0/1 bitstreams into multiple indices or codewords. A UEGk code corresponding to each index may include three parts—a part A, a part B, and a part C, or may only include a part A in unary coding. A maximum length of the unary-coded part A is variable, and the length difference of parts B and C are correlated to a “k” value which is an integer. These two values (maximum length of part A and k value) are predetermined by the decoder.
FIG. 1 shows an example of a table listing contents of a UEGk code having indices 0 to 11 respectively corresponding to parts A, B, and C. In the example, the maximum length of the part A is four bits, and bit counts of the parts B and C are the same, indicating that one-order (k=1) exponential Golomb coding is adopted. In practice, the decoder may determine a range of the part A according to the known maximum length of the part A, and determine where the part A or the part B ends according to a position of a first bit “0”. Taking FIG. 1 for example, when the input sequence is {1 1 1 1 1 1 0 0 0 1 1 1 . . . }, as the first four bits do not include “0”, the decoder may first determine that the first four bits in the input sequence are the part A of the index to be decoded. According to the position of the first bit “0” (the seventh bit in the input sequence), the decoder may identify the end of the part B to further determine that the part B is “110” and has a length of 3 bits. In this example, the lengths of the parts B and C are the same, and thus the decoder may determine that the part C are the three following bits “001”. In conclusion from the above information, the UEGk code corresponding to the index to be decoded is the first ten bits (1111110001) in the input sequence, and the subsequent bits correspond to the next index.
In the U.S. Pat. No. 6,982,663, the disclosed decoding method respectively identifies a part A, a part B, and a part C of an index, and adds values representing the three parts. Taking the above UEGk code “1111110001” for example, in the prior art, it is calculated that the value representing the part A is equal to 4 (=1+1+1+1), the value representing the part B is equal to 6 (=21+22), and the value representing the part C is equal to 1 (=20). The three values 4, 6, and 1 are added to obtain the index value as 11. However, such an approach suffers from certain setbacks. For example, the computation amount of the part B increases as the length of the part B increases (21+22+ . . . +2N), leading to increased calculation complications and thus reduced processing performance or even exceeding a system tolerable clock occurs. In general, in high-end manufacturing processes, an increased processing clock may be feasible to prevent the above issue with the sacrifice of increased power consumption and costs. Therefore, there is a need for a solution for eliminating the above setbacks.